home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / xv_pc17.zip / NOTICE.H < prev    next >
C/C++ Source or Header  |  1994-07-09  |  2KB  |  67 lines

  1. #ifndef NOTICEH
  2. #define NOTICEH
  3.  
  4. /*
  5. Confirmation window for the XView-PC interface, C version.
  6. By Antonio Carlos Moreirao de Queiroz - acmq@coe.ufrj.br
  7. Version 1.0 - 19/04/94
  8. Version 1.1 - 09/07/94 Compatible with djgpp
  9.  
  10. The function:
  11.   int notice(char *txt)
  12. prompts the user for a yes/no answer and returns 1 (yes) or 0 (no)
  13. The opened window has exclusive access, and is allocated dinamically.
  14. */
  15.  
  16. #include <string.h>
  17. #include "xview.h"
  18. #include <malloc.h>
  19.  
  20. Xv_opaque fnotice,btyes,btno;
  21. int notice_answer;
  22.  
  23. void receive_notice(Xv_opaque obj)
  24. {
  25.   notice_answer=(obj==btyes);
  26.   close_window(fnotice);
  27. }
  28.  
  29. int notice(char *txt)
  30. {
  31.   Xv_opaque temp1;
  32.   int temp2;
  33.   struct viewporttype VP;
  34.  
  35.   fnotice=xv_create(frame);
  36.     strcpy(fnotice->xv_label,txt);
  37.     fnotice->x=(getmaxx()-179)/2;
  38.     fnotice->y=(getmaxy()-39)/2;
  39.     fnotice->dx=179;
  40.     fnotice->dy=39;
  41.     fnotice->v.sframe.dymin=27;
  42.     fnotice->v.sframe.adjust_exit=0;
  43.   btyes=xv_create(button);
  44.     strcpy(btyes->xv_label,"yes");
  45.     btyes->x=50;
  46.     btyes->notify_handler=(xv_handler)receive_notice;
  47.   btno=xv_create(button);
  48.     strcpy(btno->xv_label,"no ");
  49.     btno->x=86;
  50.     btno->notify_handler=(xv_handler)receive_notice;
  51.   fnotice->v.sframe.mouse_obj=btyes;
  52.   temp1=active_w;
  53.   temp2=wallpaper;
  54.   wallpaper=1;
  55.   active_w=NULL;
  56.   getviewsettings(&VP);
  57.   xv_main_loop(fnotice);
  58.   setviewport(VP.left,VP.top,VP.right,VP.bottom,VP.clip);
  59.   xv_end=0;
  60.   wallpaper=temp2;
  61.   active_w=temp1;
  62.   free(btyes); free(btno); free(fnotice);
  63.   return notice_answer;
  64. }
  65.  
  66. #endif
  67.